import java.util.*;

public class Test4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<String> array = new ArrayList<>();

        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            array.add(scanner.nextLine());
        }
        int count = 0;
        boolean tmp = true;
        while(tmp) {
            tmp = false;
            Map<Integer,String> map = new TreeMap<>();
            for(int i = 0; i < n; i++) {
                if(array.get(i).length() > count) {
                    map.put(array.get(i).charAt(count) - '0',array.get(i));
                    tmp = true;
                }
            }
            for(Map.Entry<Integer,String> entry: map.entrySet()) {
                System.out.print(entry.getValue());
            }
            count++;
        }
    }
}
